import request from '@/utils/request'

var defultUrlNum = 0

// 查询番剧列表
export function listVideo(query) {
  return request({
    url: '/video/video/list',
    method: 'get',
    params: query
  })
}

// 查询番剧详细
export function getVideo(id) {
  return request({
    url: '/video/video/' + id,
    method: 'get'
  })
}

// 查询番剧详细
export function getHistoryVideoList(data) {
  return request({
    url: '/video/video/getHistoryVideoList',
    method: 'get',
    params: data
  })
}

// 新增番剧
export function addVideo(data) {
  return request({
    url: '/video/video',
    method: 'post',
    data: data
  })
}

// 修改番剧
export function updateVideo(data) {
  return request({
    url: '/video/video',
    method: 'put',
    data: data
  })
}

// 删除番剧
export function delVideo(id) {
  return request({
    url: '/video/video/' + id,
    method: 'delete'
  })
}

/**
 * 上传头图
 * @param data
 * @returns {*}
 */
export function uploadHeadImg(data) {
  return request({
    url: '/video/video/imgUpload',
    method: 'post',
    data: data
  })
}

/**
 * 上传视频
 * @param data
 * @returns {*}
 */
export function uploadVideo(data) {
  return request({
    url: '/video/videoFile/videoUpload?t=' + ++defultUrlNum,
    method: 'post',
    data: data
  })
}

/**
 * 保存视频数据
 * @param data
 * @returns {*}
 */
export function batchSaveVideoFile(data) {
  return request({
    url: '/video/videoFile/batchSave',
    method: 'post',
    data: data
  })
}

/**
 * 刷新视频文件
 * @returns {*}
 */
export function syncVideoFolder() {
  return request({
    url: '/video/video/syncVideoFolder',
    method: 'post'
  })
}
